<?php
/**
 *  后台代理customer的路由
 * Author: lyun
 * Date: 2018/3/30
 * Created by Panxsoft.
 */
use Illuminate\Support\Facades\Route;

Route::group([
    'prefix'=>'customer',
    'namespace'=>'Admin\Customer',
    'middleware'=>'CustomerAuth'
], function(){
    /**
     * 首页面板
     *
     * @see \App\Http\Controllers\Admin\Customer\DashboardController::index
     */
    Route::get('/dashboard', 'DashboardController@index')
        ->name(\App\Http\Controllers\Admin\Customer\DashboardController::ROUTES['index']);

    /**
     * @deprecated
     * 访客统计数据
     *
     * @see \App\Http\Controllers\Admin\Customer\DashboardController::getvisitCounts()
     */
    Route::get('/get-visit-counts', 'DashboardController@getvisitCounts');

    /**
     * 测肤统计数据
     *
     * @see \App\Http\Controllers\Admin\Customer\DashboardController::getStoresskinCounts()
     */
    Route::get('/get-skin-counts', 'DashboardController@getStoresskinCounts')
        ->name(\App\Http\Controllers\Admin\Customer\DashboardController::ROUTES['store-skin-counts']);


    /**
     * 所有店铺的测肤统计数据
     *
     * @see \App\Http\Controllers\Admin\Customer\DashboardController::getCustomerAllStoreSkinCounts()
     */
    Route::get('/get-customer-skin-counts', 'DashboardController@getCustomerAllStoreSkinCounts')
        ->name(\App\Http\Controllers\Admin\Customer\DashboardController::ROUTES['user-skin-counts']);

    /**
     * 职员的管理
     *
     * @see \App\Http\Controllers\Admin\Customer\CustomerStaffController
     */
    Route::resource('/staff', 'CustomerStaffController')
        ->names(\App\Http\Controllers\Admin\Customer\CustomerStaffController::ROUTES);

    /**
     * 后台职员启用和禁用切换
     *
     * @see \App\Http\Controllers\Admin\Customer\CustomerStaffController::patchEnabled()
     */
    Route::patch('/staff-status/{staff_id}', 'CustomerStaffController@patchEnabled')
        ->name(\App\Http\Controllers\Admin\Customer\CustomerStaffController::ROUTES['patch']);

    /**
     * 店铺的管理
     *
     * @see \App\Http\Controllers\Admin\Customer\StoreController
     */
    Route::resource('/store', 'StoreController')
        ->names(\App\Http\Controllers\Admin\Customer\StoreController::ROUTE_NAMES);

    /**
     * 关停/开启 店铺
     *
     * @see \App\Http\Controllers\Admin\Customer\StoreController::patchDelete
     */
    Route::patch('/store-delete/{store_id}', 'StoreController@patchDelete')
        ->name(\App\Http\Controllers\Admin\Customer\StoreController::ROUTE_NAMES['patch_delete']);

    /**
     * 设备账号的管理
     *
     * @see \App\Http\Controllers\Admin\Customer\DeviceAccountController
     */
    Route::resource('/device-account', 'DeviceAccountController')
        ->names(\App\Http\Controllers\Admin\Customer\DeviceAccountController::ROUTES);

    /**
     * 后台2.5d发型素材的管理
     *
     * @see \App\Http\Controllers\Admin\Customer\HairAssetController
     */
    Route::resource('/hair-asset', 'HairAssetController');

    /**
     * @deprecated
     *
     * @see \App\Http\Controllers\Admin\Customer\DeviceAccountController::unbindDevice()
     */
    Route::patch('/device-account-unbind-device/{account_id}', 'DeviceAccountController@unbindDevice');

    /**
     * @see \App\Http\Controllers\Admin\Customer\DeviceAccountController::patchEnabled()
     */
    Route::patch('/device-account-enabled/{account_id}', 'DeviceAccountController@patchEnabled')
        ->name(\App\Http\Controllers\Admin\Customer\DeviceAccountController::ROUTES['patch']);

    /**
     * 微信用户详情和测肤统计数据
     *
     * @see \App\Http\Controllers\Admin\Customer\WechatUserController::showWithSkinRecordInfo()
     */
    Route::get('/wechat-user/show-with-skin-record-info', 'WechatUserController@showWithSkinRecordInfo')
        ->name(\App\Http\Controllers\Admin\Customer\WechatUserController::ROUTES['showWithSkinRecordInfo']);

    /**
     * 微信用户列表
     *
     * @see \App\Http\Controllers\Admin\Customer\WechatUserController
     */
    Route::resource('/wechat-user', 'WechatUserController')
        ->names(\App\Http\Controllers\Admin\Customer\WechatUserController::ROUTES);

    /**
     * 导出商家微信用户列表
     *
     * @see \App\Http\Controllers\Admin\Customer\WechatUserController::exportCustomerUser()
     */
    Route::get('/export-customer-user', 'WechatUserController@exportCustomerUser');

    /**
     * 整体妆容管理
     *
     * @see \App\Http\Controllers\Admin\Customer\PackController
     */
    Route::resource('/pack', 'PackController')
        ->names(\App\Http\Controllers\Admin\Customer\PackController::ROUTES);

    /**
     * 整体妆容类别管理
     *
     * @see \App\Http\Controllers\Admin\Customer\PackCategoryController
     */
    Route::resource('/pack-category', 'PackCategoryController')
        ->names(\App\Http\Controllers\Admin\Customer\PackCategoryController::ROUTE_NAMES);

    /**
     * app端屏保轮播图的管理
     *
     * @see \App\Http\Controllers\Admin\Customer\BannerController
     */
    Route::resource('/banner', 'BannerController')
        ->names(\App\Http\Controllers\Admin\Customer\BannerController::ROUTE_NAMES);

    /**
     * 广告管理
     *
     * @see \App\Http\Controllers\Admin\Customer\AdvertController
     */
    Route::resource('/advert', 'AdvertController')
        ->names(\App\Http\Controllers\Admin\Customer\AdvertController::ROUTES);

    /**
     * 订单管理
     *
     * @see \App\Http\Controllers\Admin\Customer\OrderController
     */
    Route::resource('/order', 'OrderController',['only' => ['index', 'show']])
        ->names(\App\Http\Controllers\Admin\Customer\OrderController::ROUTES);

    /**
     * 单个素材
     *
     * @see \App\Http\Controllers\Admin\Customer\AssetController
     */
    Route::resource('/asset', 'AssetController')
        ->names(\App\Http\Controllers\Admin\Customer\AssetController::ROUTES);

    /**
     * 同步有赞的订单
     *
     * @see \App\Http\Controllers\Admin\Customer\OrderController::syncOrders()
     */
    Route::post('/order', 'OrderController@syncOrders');

    /**
     * 产品管理组
     */
    Route::group([
        'namespace'=>'Product'
    ], function(){

        /**
         * customer后台自有商品品牌的管理
         *
         * @see \App\Http\Controllers\Admin\Customer\Product\ProductBrandController
         */
        Route::resource('/brand', 'ProductBrandController')
            ->names(\App\Http\Controllers\Admin\Customer\Product\ProductBrandController::ROUTES);

        /**
         * customer后台自有商品品牌系列的管理
         *
         * @see \App\Http\Controllers\Admin\Customer\Product\BrandSeriesController
         */
        Route::resource('/brand-series', 'BrandSeriesController')
            ->names(\App\Http\Controllers\Admin\Customer\Product\BrandSeriesController::ROUTE_NAMES);

        /**
         * 添加商品时，请求product_model数据 或 category数据
         *
         * @see \App\Http\Controllers\Admin\Customer\Product\ProductController::createInfo()
         */
        Route::get('/product/create-info', 'ProductController@createInfo');

        /**
         * 商品的管理
         *
         * @see \App\Http\Controllers\Admin\Customer\Product\ProductController
         */
        Route::resource('/product', 'ProductController')
            ->names(\App\Http\Controllers\Admin\Customer\Product\ProductController::ROUTES);


        /**
         * 有赞商品的管理
         *
         * @see \App\Http\Controllers\Admin\Customer\Product\YouzanProductController::syncItemsOnSale()
         */
        Route::post('/youzan/sync_on_sale_product', 'YouzanProductController@syncItemsOnSale')
            ->name('admin.customer.sync_on_sale_product');

        /**
         * 有赞商品的管理
         *
         * @see \App\Http\Controllers\Admin\Customer\Product\YouzanProductController::syncItemsInventory()
         */
        Route::post('/youzan/sync_inventory_product', 'YouzanProductController@syncItemsInventory')
            ->name('admin.customer.sync_inventory_product');


        /**
         * 查看店铺的商品列表
         *
         * @see \App\Http\Controllers\Admin\Customer\Product\ProductController::indexStoreProducts()
         */
        Route::get('/store-product', 'ProductController@indexStoreProducts')
            ->name(\App\Http\Controllers\Admin\Customer\Product\ProductController::ROUTES['indexStoreProducts']);

        /**
         * 修改商品的状态信息
         *
         * @see \App\Http\Controllers\Admin\Customer\Product\ProductController::patchStatus()
         */
        Route::patch('/product-status', 'ProductController@patchStatus')
            ->name(\App\Http\Controllers\Admin\Customer\Product\ProductController::ROUTES['patchStatus']);

        /**
         * 导出商品列表
         *
         * @see \App\Http\Controllers\Admin\Customer\Product\ProductController::exportCustomerProduct()
         */
        Route::get('/export-customer-product', 'ProductController@exportCustomerProduct');

        /**
         * 删除商品关联的图片
         *
         * @see \App\Http\Controllers\Admin\Customer\Product\ProductImageController::destroy()
         */
        Route::delete('/product-image/{prod_img_id}', 'ProductImageController@destroy');

        // 后台虚拟仓和商品的管理
        /**
         * 虚拟商品的管理
         *
         * @see \App\Http\Requests\Admin\Customer\VirtualProductIndexRequest
         */
        Route::resource('/virtual-product', 'VirtualProductController');

        /**
         * deprecated 虚拟仓商品的开启和关闭
         *
         * @see \App\Http\Controllers\Admin\Customer\Product\VirtualProductController::openVirtualProduct()
         */
        Route::post('/virtual-status', 'VirtualProductController@openVirtualProduct');

        /**
         * 产品类别管理
         *
         * @see \App\Http\Controllers\Admin\Customer\Product\CategoryController
         */
        Route::resource('/category', 'CategoryController')
            ->names(\App\Http\Controllers\Admin\Customer\Product\CategoryController::ROUTES);

        /**
         * 化妆品材质管理
         *
         * @see \App\Http\Controllers\Admin\Customer\Product\CosmeticMaterialController
         */
        Route::resource('/cosmetic-material', 'CosmeticMaterialController')
            ->names(\App\Http\Controllers\Admin\Customer\Product\CosmeticMaterialController::ROUTES);

    });

    /**
     * 肤质检测数据的统计
     *
     * @see \App\Http\Controllers\Admin\Customer\SkinRecordController::indexUsageCount()
     */
    Route::get('/skin-record/index-usage-count', 'SkinRecordController@indexUsageCount')
        ->name(\App\Http\Controllers\Admin\Customer\SkinRecordController::ROUTES['indexUsageCount']);

    /**
     * 肤质检测数据的展示(详情)
     *
     * @see \App\Http\Controllers\Admin\Customer\SkinRecordController::indexGroupByStores()
     */
    Route::get('/skin-record/index-group-by-stores', 'SkinRecordController@indexGroupByStores')
        ->name(\App\Http\Controllers\Admin\Customer\SkinRecordController::ROUTES['indexGroupByStores']);

    /**
     * 根据肤质检测数据统计饼图数据
     *
     * @see \App\Http\Controllers\Admin\Customer\SkinRecordController::showPieChartData()
     */
    Route::get('/skin-record/pie-chart-data', 'SkinRecordController@showPieChartData')
        ->name(\App\Http\Controllers\Admin\Customer\SkinRecordController::ROUTES['showPieChartData']);

    /**
     * 肤质检测数据的展示
     *
     * @see \App\Http\Controllers\Admin\Customer\SkinRecordController
     */
    Route::resource('/skin-record', 'SkinRecordController')
        ->names(\App\Http\Controllers\Admin\Customer\SkinRecordController::ROUTES);

    /**
     * 肤质检测数据的展示(详情)
     *
     * @see \App\Http\Controllers\Admin\Customer\SkinRecordController::skinRecordList
     */
    Route::get('skin-record-list', 'SkinRecordController@skinRecordList')
        ->name(\App\Http\Controllers\Admin\Customer\SkinRecordController::ROUTES['list']);

    /**
     * 共享商品 SKU
     * @see \App\Http\Controllers\Admin\Customer\Share\ShareProductController
     */
    Route::resource('share-product', 'Share\ShareProductController')
        ->names(\App\Http\Controllers\Admin\Customer\Share\ShareProductController::ROUTES);

    /**
     * 公司信息管理（新鸿基）
     * @see \App\Http\Controllers\Admin\Customer\CompanyManageController
     */
    Route::resource('customer-company', 'CompanyManageController')
        ->names(\App\Http\Controllers\Admin\Customer\CompanyManageController::ROUTES);

    /**
     * 自定义wax测肤建议的管理
     * @see \App\Http\Controllers\Admin\Customer\WaxSkinSuggestController
     */
    Route::resource('wax-skin-suggest', 'WaxSkinSuggestController')
        ->names(\App\Http\Controllers\Admin\Customer\WaxSkinSuggestController::ROUTES);

    /**
     * 自定义HM测肤建议的管理
     * @see \App\Http\Controllers\Admin\Customer\HmSkinSuggestController
     */
    Route::resource('hm-skin-suggest', 'HmSkinSuggestController')
        ->names(\App\Http\Controllers\Admin\Customer\HmSkinSuggestController::ROUTES);

    /**
     * wax测肤分数关联商品列表
     * @see \App\Http\Controllers\Admin\Customer\RecommendProductController::waxIndex()
     */
    Route::get('wax-recommend-product', 'RecommendProductController@waxIndex')
        ->name(\App\Http\Controllers\Admin\Customer\RecommendProductController::ROUTES['waxIndex']);

    /**
     * hm测肤分数关联商品列表
     * @see \App\Http\Controllers\Admin\Customer\RecommendProductController::hmIndex()
     */
    Route::get('hm-recommend-product', 'RecommendProductController@hmIndex')
        ->name(\App\Http\Controllers\Admin\Customer\RecommendProductController::ROUTES['hmIndex']);

    /**
     * 新增单个wax/hm测肤分数关联商品
     * @see \App\Http\Controllers\Admin\Customer\RecommendProductController::singleStore()
     */
    Route::post('single-recommend-product', 'RecommendProductController@singleStore')
        ->name(\App\Http\Controllers\Admin\Customer\RecommendProductController::ROUTES['singleStore']);

    /**
     * hm，wax测肤分数关联商品
     * @see \App\Http\Controllers\Admin\Customer\RecommendProductController
     */
    Route::resource('recommend-product', 'RecommendProductController')
        ->names(\App\Http\Controllers\Admin\Customer\RecommendProductController::ROUTES);

});

Route::group([
    'prefix'     => 'customer',
    'namespace'  => 'Youzan',
    'middleware' => 'CustomerAuth'
], function(){
    /**
     * 有赞店铺授权信息管理
     *
     * @see \App\Http\Controllers\Youzan\YouzanShopController::show()
     */
    Route::get('/youzan-shop', 'YouzanShopController@show');
});

